package com.kaixinff.jetty;

import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.thread.BoundedThreadPool;



public class JettyServer {
	public static void main(String[] args) throws Exception {
		
		Server server = new Server();
		BoundedThreadPool threadPool = new BoundedThreadPool();
		threadPool.setMaxThreads(100);
		server.setThreadPool(threadPool);
		Connector connector = new SelectChannelConnector();
		connector.setPort(80);
		server.setConnectors(new Connector[] { connector });
		WebAppContext context = new WebAppContext(ClassLoader.getSystemClassLoader().getResource("").getPath() + "../..", "/");
		server.addHandler(context);
		server.setStopAtShutdown(true);
		server.setSendServerVersion(true);
		server.start();
		server.join();
    }

}
